package com.framework;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import com.framework.actionbar.ActivityActionBar;
import com.framework.medaipalyer.MediaPlayerActivity;
import com.framework.ndk.FrameNDKActivity;
import com.framework.net.ActivityNet;
import com.framework.sensosr.SenorsActivity;
import com.framework.surfaces.TDSurfacesActivity;
import com.framework.window.FWWindowAcitvity;
import com.framework.window.TitleActity;
import com.uusee.pp.nativ.UuseeHttpTools;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.AssetManager;
import android.net.Uri;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;
import android.view.View;

public class RootActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		PackageManager pm = getPackageManager();
		ApplicationInfo ai;
		AssetManager ass  = getAssets();
		InputStream in;
		ByteArrayOutputStream  temp = new ByteArrayOutputStream();
		OutputStream out;
		try {
			in = ass.open("1.txt");
			byte[] buffer = new byte[1024];
			int len = 0;
			len = in.read(buffer);
			int offset = 0;
			while(len != -1){

				temp.write(buffer,0, len);
				len = in.read(buffer);
//				offset += len;
			}
			String str = new String(temp.toByteArray());
			Log.d("com.framework",str);
			temp.close();
			in.close();
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	}
	public void startNDK(View view){
		Intent intent = new Intent(this,FrameNDKActivity.class);
		startActivity(intent);
	}
	public void startWindow(View view){
		Intent intent = new Intent(this,FWWindowAcitvity.class);
		startActivity(intent);
	}
	public void startActionBar(View view){
		Intent intent = new Intent(this,ActivityActionBar.class);
		startActivity(intent);
	}
	public void startNet(View view){
		Intent intent = new Intent(this,ActivityNet.class);
		startActivity(intent);
	}
	public void startTitle(View view){
		Intent intent = new Intent(this,TitleActity.class);
		startActivity(intent);
	}
	public void startMediaPlayer(View view){
		Intent intent = new Intent(this,MediaPlayerActivity.class);
		startActivity(intent);
	}
	public void startSensorActivity(View view){
		Intent intent = new Intent(this,SenorsActivity.class);
		startActivity(intent);
	}
	public void startsurfacesActivity(View view){
		Intent intent = new Intent(this,TDSurfacesActivity.class);
		startActivity(intent);
	}
	public void startHttpGet(View view){
		String str = UuseeHttpTools.get("http://61.131.252.136/D5455BCF-0000-0000-FFFF-FFFFFFFFFF14.unp?multi=3");
		Log.d("root","str===="+str);
		StringBuilder sb = new StringBuilder("http://player.uusee.com/flv_player/xml/B0/2A/");
		sb.append("{");
		sb.append("D5455BCF-0000-0000-FFFF-FFFFFFFFFF14");
		sb.append("}.xml");
		String str2 = Uri.encode(sb.toString());
		Log.d("root","str2======"+str2);
		Log.d("root","xml==="+UuseeHttpTools.get("http://player.uusee.com/flv_player/xml/B0/2A/%7BB02A0607-0000-0000-FFFF-FFFFFFFFFF14%7D.xml"));
	}
}
